package org.rency.common.utils.domain;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class BaseResult {

	private boolean isSuccess;
	private String returnCode;
	private String returnMessage;
	
	public BaseResult(){}
	
	public static BaseResult success(String returnMessage){
		BaseResult result = new BaseResult();
		result.setSuccess(true);
		result.setReturnMessage(returnMessage);
		return result;
	}
	
	public static BaseResult fail(String returnMessage){
		BaseResult result = new BaseResult();
		result.setSuccess(false);
		result.setReturnMessage(returnMessage);
		return result;
	}
	
	public static BaseResult fail(String returnCode,String returnMessage){
		BaseResult result = new BaseResult();
		result.setSuccess(false);
		result.setReturnCode(returnCode);
		result.setReturnMessage(returnMessage);
		return result;
	}
	
	public boolean isSuccess() {
		return isSuccess;
	}

	public void setSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(String returnCode) {
		this.returnCode = returnCode;
	}

	public String getReturnMessage() {
		return returnMessage;
	}

	public void setReturnMessage(String returnMessage) {
		this.returnMessage = returnMessage;
	}

	public String toString(){
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
	
}